xend: Don't allow dom0 memory to be ballooned below dom0-min-mem
authorKeir Fraser <keir.fraser@citrix.com>
Sat, 5 Apr 2008 21:25:30 +0000 (22:25 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Sat, 5 Apr 2008 21:25:30 +0000 (22:25 +0100)
configuration parameter.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
tools/python/xen/xend/XendDomainInfo.py

index ff5de1cd10abd5280f971210e4c05db9396f0bda..a88dfb4a3f4fbde365dc7798fffceee57af6ddf9 100644 (file)
@@ -986,6 +986,13 @@ class XendDomainInfo:
                   self.info['name_label'], str(self.domid), target)
         
         MiB = 1024 * 1024
+
+        if self.domid == 0:
+            dom0_min_mem = xoptions.get_dom0_min_mem()
+            memory_cur = self.get_memory_dynamic_max() / MiB
+            if target < memory_cur and dom0_min_mem > target:
+                raise XendError("memory_dynamic_max too small")
+
         self._safe_set_memory('memory_dynamic_min', target * MiB)
         self._safe_set_memory('memory_dynamic_max', target * MiB)